package com.baylor.ui.fragment;

import com.baylor.ui.MainActivity;
import com.baylor.ui.R;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public abstract class AbsTabFragment extends Fragment {

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return inflater.inflate(R.layout.fragment_tab, container, false);
	}
	
	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		view.setBackgroundColor( getFragmentBackgroundColor() );
	}
	
	public MainActivity getMainActivity() {
		return (MainActivity)getActivity();
	}
	
	/**
	 * 得到 Fragment 的背景颜色
	 * @return Color 背景颜色
	 */
	protected abstract int getFragmentBackgroundColor();
}
